/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sql;

/**
 *
 * @author Alexx
 */
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Conector {
  
   private static Statement statement;
   
   private Conector(){
     
   }
   
   public static Statement conect() throws SQLException{
     try {
            Class.forName("org.hsqldb.jdbcDriver");
            //Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            System.err.println("НЕ удалось загрузить драйвер ДБ.");
            e.printStackTrace();
            System.exit(1);
        }
        Connection connection = null;
        try {
            connection = DriverManager.getConnection("jdbc:hsqldb:file:D:/class/persone", "SA", "");
            //connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/persone", "", "");
        } catch (SQLException e) {
            System.err.println("НЕ удалось оздать соединение.");
            e.printStackTrace();
            System.exit(1);
        }
        statement = connection.createStatement();
        return statement;
   }
   
}
